package cn.iocoder.yudao.module.hs.dal.mysql.receiveorder;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.hs.dal.dataobject.receiveorder.ReceiveOrderDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.hs.controller.admin.receiveorder.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 收货单 Mapper
 *
 * @author 航盛
 */
@Mapper
public interface ReceiveOrderMapper extends BaseMapperX<ReceiveOrderDO> {

    default PageResult<ReceiveOrderDO> selectPage(ReceiveOrderPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ReceiveOrderDO>()
                .likeIfPresent(ReceiveOrderDO::getNo, reqVO.getNo())
                .eqIfPresent(ReceiveOrderDO::getShipOrderId, reqVO.getShipOrderId())
                .likeIfPresent(ReceiveOrderDO::getShipOrderCode, reqVO.getShipOrderCode())
                .eqIfPresent(ReceiveOrderDO::getConsignee, reqVO.getConsignee())
                .betweenIfPresent(ReceiveOrderDO::getReceiveTime, reqVO.getReceiveTime())
                .eqIfPresent(ReceiveOrderDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(ReceiveOrderDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ReceiveOrderDO::getId));
    }

    List<ReceiveOrderTrayRespVO> getTrayList(@Param("shipOrderId") Long shipOrderId, @Param("warehouseId") Long warehouseId);
}